Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Desktop Switch Triggers for different animations #1262

Closed
wants to merge 24 commits into from

Conversation

pijulius
Copy link
Contributor

This adds support for desktop switching animations by keeping track of _NET_CURRENT_DESKTOP atom on the root window.

As far as I understand this atom is set by window managers and so if it changes we can know that it's a desktop switch happening. Unfortunately window manager may need to set this BEFORE hiding/showing windows so we can animate correctly, me personally using FluxBox and this quick change pijulius/fluxbox@83ee4db makes it work just fine.

It adds the following animation triggers:

  • workspace-out
  • workspace-out-inverse
  • workspace-in
  • workspace-in-inverse

Unfortunately had to add inverse variables too as you may navigate to the next workspace from for e.g. 1st to 2nd but you may also go to 2nd from 1st and in that case the animations have to be totally different.

Here is a config example for switching workspace:

animations = ({
triggers = ["workspace-out"];
offset-y = {
timing = "0.2s cubic-bezier(0.21, 0.02, 0.76, 0.36)";
start = "0";
end = "-window-height";
};
shadow-offset-y = "offset-y";
opacity = {
timing = "0.2s linear";
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
blur-opacity = "opacity";
shadow-opacity = "opacity";
},
{
triggers = ["workspace-out-inverse"];
offset-y = {
timing = "0.2s cubic-bezier(0.21, 0.02, 0.76, 0.36)";
start = "0";
end = "window-height + window-y";
};
shadow-offset-y = "offset-y";
opacity = {
timing = "0.2s linear";
start = "window-raw-opacity-before";
end = "window-raw-opacity";
};
blur-opacity = "opacity";
shadow-opacity = "opacity";
},
{
triggers = ["workspace-in"];
offset-y = {
timing = "0.2s cubic-bezier(0.24, 0.64, 0.79, 0.98)";
start = "window-height + window-y";
end = "0";
};
shadow-offset-y = "offset-y";
opacity = {
timing = "0.2s linear";
start = "0";
end = "window-raw-opacity";
};
blur-opacity = "opacity";
shadow-opacity = "opacity";
},
{
triggers = ["workspace-in-inverse"];
offset-y = {
timing = "0.2s cubic-bezier(0.24, 0.64, 0.79, 0.98)";
start = "-window-height";
end = "0";
};
shadow-offset-y = "offset-y";
opacity = {
timing = "0.2s linear";
start = "0";
end = "window-raw-opacity";
};
blur-opacity = "opacity";
shadow-opacity = "opacity";
})

yshui and others added 22 commits May 16, 2024 18:38
Allow the definition of customizable animations using expressions and
transition curves.

Signed-off-by: Yuxuan Shui <[email protected]>
We should always process all the X events in libxcb's queue with the
server grabbed, not just when we have `pending_updates` flag set.

This is the only way to make sure we always render with up-to-date
server states.

Signed-off-by: Yuxuan Shui <[email protected]>
Remove the old fading machinary. As a side-effect, animation and time
based shaders are now unified.

Signed-off-by: Yuxuan Shui <[email protected]>
An attempt to make rendering with damage deterministic even when
replayed from a trace.

Signed-off-by: Yuxuan Shui <[email protected]>
Signed-off-by: Yuxuan Shui <[email protected]>
This can be used to prevent another animation from interrupting the
current running animation.

Signed-off-by: Yuxuan Shui <[email protected]>
This adds support for desktop switching animations by keeping track of _NET_CURRENT_DESKTOP atom on the root window. 

As far as I understand this atom is set by window managers and so if it changes we can know that it's a desktop switch happening. Unfortunately window manager may need to set this BEFORE hiding/showing windows so we can animate correctly, me personally using FluxBox and this quick change pijulius/fluxbox@83ee4db  makes it work just fine.

It adds the following animation triggers:
* workspace-out
* workspace-out-inverse
* workspace-in
* workspace-in-inverse

Unfortunately had to add inverse variables too as you may navigate to the next workspace from for e.g. 1st to 2nd but you may also go to 2nd from 1st and in that case the animations have to be totally different.

Here is a config example for switching workspace:

animations = ({
    triggers = ["workspace-out"];
    offset-y = {
        timing = "0.2s cubic-bezier(0.21, 0.02, 0.76, 0.36)";
        start = "0";
        end = "-window-height";
    };
    shadow-offset-y = "offset-y";
    opacity = {
        timing = "0.2s linear";
        start = "window-raw-opacity-before";
        end = "window-raw-opacity";
    };
    blur-opacity = "opacity";
    shadow-opacity = "opacity";
},
{
    triggers = ["workspace-out-inverse"];
    offset-y = {
        timing = "0.2s cubic-bezier(0.21, 0.02, 0.76, 0.36)";
        start = "0";
        end = "window-height + window-y";
    };
    shadow-offset-y = "offset-y";
    opacity = {
        timing = "0.2s linear";
        start = "window-raw-opacity-before";
        end = "window-raw-opacity";
    };
    blur-opacity = "opacity";
    shadow-opacity = "opacity";
},
{
    triggers = ["workspace-in"];
    offset-y = {
        timing = "0.2s cubic-bezier(0.24, 0.64, 0.79, 0.98)";
        start = "window-height + window-y";
        end = "0";
    };
    shadow-offset-y = "offset-y";
    opacity = {
        timing = "0.2s linear";
        start = "0";
        end = "window-raw-opacity";
    };
    blur-opacity = "opacity";
    shadow-opacity = "opacity";
},
{
    triggers = ["workspace-in-inverse"];
    offset-y = {
        timing = "0.2s cubic-bezier(0.24, 0.64, 0.79, 0.98)";
        start = "-window-height";
        end = "0";
    };
    shadow-offset-y = "offset-y";
    opacity = {
        timing = "0.2s linear";
        start = "0";
        end = "window-raw-opacity";
    };
    blur-opacity = "opacity";
    shadow-opacity = "opacity";
})
@pijulius pijulius mentioned this pull request May 18, 2024
@yshui
Copy link
Owner

yshui commented May 18, 2024

Unfortunately window manager may need to set this BEFORE hiding/showing windows so we can animate correctly

Yeah, that's the problem I was thinking when I said this is impossible. Because the order of changes is not defined by any specification. So unless we can somehow convince all window managers to change, I don't think we can rely on this. If we do what we get will be endless streams of bug reports from people using a window manager that behaves differently...

And beyond that, your implementation also requires that the _NET_CURRENT_DESKTOP change happens in the same frame as the maps/unmaps, which isn't guaranteed either.

@pijulius
Copy link
Contributor Author

Yep, got it, nw, thanks for the inputs!

Unfortunately atm don't know any other way to implement this, it worked out just fine for myself in the last years so will keep it and let it here till there is a better solution.

@yshui
Copy link
Owner

yshui commented May 18, 2024

My plan is to add a dbus interface and custom animation triggers. so you can, for example, run a dbus-send in your switch workspace key binding to start a workspace animation.

@pijulius
Copy link
Contributor Author

Hmm, that sounds great, so could use dbus to sign picom that workspace switching is happening, just not sure if the dbus event is picked up sooner than the windows start to hide/show but do like the idea a lot!

yshui and others added 2 commits May 19, 2024 08:48
Define script context variables describing the monitor a window is on.

Signed-off-by: Yuxuan Shui <[email protected]>
@yshui yshui deleted the branch yshui:animation-part2 May 19, 2024 21:06
@yshui yshui closed this May 19, 2024
@absolutelynothelix absolutelynothelix mentioned this pull request Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants